package com.bpr.webservice.domain.dto;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;

import com.bpr.webservice.domain.Menuaccess;

public class MenuaccessPageDto implements Page<MenuaccessDto>{

	private Page<Menuaccess> searchResult;
	
	public MenuaccessPageDto(Page<Menuaccess> result){
		this.searchResult = result;
	}
	
	@Override
	public List<MenuaccessDto> getContent() {
		List<MenuaccessDto> result = new ArrayList<MenuaccessDto>();
		MenuaccessDto dto = null;
		for (Menuaccess ma : searchResult.getContent()){
			dto = new MenuaccessDto();
			dto.constructDto(ma);
			result.add(dto);
		}
		return result;
	}

	@Override
	public int getNumber() {
		return searchResult.getNumber();
	}

	@Override
	public int getNumberOfElements() {
		return searchResult.getNumberOfElements();
	}

	@Override
	public int getSize() {
		return searchResult.getSize();
	}

	@Override
	public Sort getSort() {
		return searchResult.getSort();
	}

	@Override
	public long getTotalElements() {
		return searchResult.getTotalElements();
	}

	@Override
	public int getTotalPages() {
		return searchResult.getTotalPages();
	}

	@Override
	public boolean hasContent() {
		return searchResult.hasContent();
	}

	@Override
	public boolean hasNextPage() {
		return searchResult.hasNextPage();
	}

	@Override
	public boolean hasPreviousPage() {
		return searchResult.hasPreviousPage();
	}

	@Override
	public boolean isFirstPage() {
		return searchResult.isFirstPage();
	}

	@Override
	public boolean isLastPage() {
		return searchResult.isLastPage();
	}

	@Override
	public Iterator<MenuaccessDto> iterator() {
		return getContent().iterator();
	}

}
